<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    

    <script>
        // ajax 异步执行任务 
        // 回调函数 
        
        // 1.
        var xhr = new XMLHttpRequest() 
        // 2.
        xhr.open("get",'../data/demo.txt',true)
        // 3.
        xhr.send()
        // 4.
        xhr.onreadystatechange = function(){
            console.log(xhr.readyState)
            if(xhr.readyState ==4 && xhr.status == 200){
                console.log("数据请求成功----" + xhr.responseText)
            }
        } 


        console.log("hello - wuhan - 0818 ")

        setTimeout(()=>{
            console.log("wuhan2107 - yyds ...")
        },1000)

        console.log("ajax 代码执行完毕...")
    </script>
</body>
</html>